package com.lyf.scm.plan.insfrastructure.db.mapper;

import com.lyf.scm.plan.insfrastructure.db.dataobject.SalesPlanDirectlyInfoDO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * description:
 *          直营预测计划明细
 * @author: haodong
 * @data: 2020/8/20 13:50
 */
public interface SalesPlanDirectlyInfoMapper {


    /**
     * 根据用户id及时间范围查询明细
     * @param userIdList
     * @param startTime
     * @param endTime
     * @return
     */
    List<SalesPlanDirectlyInfoDO> listByUserId(@Param("userIdList") List<Long> userIdList,
                                               @Param("startTime") Date startTime,
                                               @Param("endTime") Date endTime);

    /**
     * 更新确认量
     * @param salesPlanDirectlyInfo
     * @return
     */
    Integer updateConfirm(List<SalesPlanDirectlyInfoDO> salesPlanDirectlyInfo);

    /**
     * 根据主表id查询明细
     * @param idList
     * @return
     */
    List<SalesPlanDirectlyInfoDO> listByDirectlyId(List<Long> idList);

    /**
     * 新增确认量
     * @param salesPlanDirectlyInfo
     * @return
     */
    Integer insertConfirm(List<SalesPlanDirectlyInfoDO> salesPlanDirectlyInfo);

    List<SalesPlanDirectlyInfoDO> listByDirectlyUserId(@Param("idList") List<Long> idList, @Param("userId") long userId);

    List<SalesPlanDirectlyInfoDO> listByIdAndUser(@Param("userIdList") List<Long> userIdList, @Param("idList") List<Long> idList);

    /**
     * 根据ids删除直营预测计划详细表
     *
     * @param ids
     */
    void deleteInfo(@Param("ids") List<Long> ids);

    List<SalesPlanDirectlyInfoDO> listInfoByUserId(@Param("userIdList") List<Long> userIdList,
                                                       @Param("weekDateList") List<Map<String, Date>> weekDateList,
                                                       @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
